{	V Open School Programming Olympiad
	Problem A
	Points: 100
}

var a,used:array[1..4] of integer; count,i,j:integer;
begin
assign(input,'durak.in');
assign(output,'durak.out');
reset(input);
rewrite(output);
count:=0;
for i:=1 to 4 do used[i]:=0;
for i:=1 to 4 do read(a[i]);
for i:=2 to 4 do begin
  if a[i]<>0 then begin
    for j:=1 to i-1 do begin
      if (a[i]=a[j]) and (used[j]=0) then begin
        inc(count);
        used[j]:=1;
      end;
    end;
  end;
end;
writeln(count);
close(input);
close(output);
end.
 